package com.vibrationkeyboard.app.processor

import com.vibrationkeyboard.app.model.SensorData
import org.junit.Test
import org.junit.Assert.*
import org.junit.Before

class SignalProcessorTest {

    private lateinit var signalProcessor: SignalProcessor

    @Before
    fun setUp() {
        signalProcessor = SignalProcessor()
    }

    @Test
    fun testProcessSensorData() {
        // 创建测试数据
        val testData = listOf(
            SensorData(1f, 2f, 3f),
            SensorData(2f, 3f, 4f),
            SensorData(3f, 4f, 5f)
        )
        
        // 处理数据
        signalProcessor.processSensorData(testData)
        
        // 验证处理结果
        val result = signalProcessor.getLatestRecognitionResult()
        // 由于是模拟数据，结果可能为null或"未知"
        assertNotNull("处理结果不应为null", result)
    }

    @Test
    fun testEmptyData() {
        val emptyData = emptyList<SensorData>()
        signalProcessor.processSensorData(emptyData)
        
        val result = signalProcessor.getLatestRecognitionResult()
        assertNull("空数据应该返回null", result)
    }

    @Test
    fun testLargeData() {
        // 创建大量测试数据
        val largeData = (1..100).map { i ->
            SensorData(i.toFloat(), (i + 1).toFloat(), (i + 2).toFloat())
        }
        
        signalProcessor.processSensorData(largeData)
        
        val result = signalProcessor.getLatestRecognitionResult()
        assertNotNull("大量数据应该能正常处理", result)
    }
} 